﻿<Window x:Class="SpiralClockDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:spiral="clr-namespace:SpiralClock;assembly=SpiralClock"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525">

    <Grid>

        <spiral:SpiralItemsControl Margin="100" x:Name="spiralClock" >

            <spiral:SpiralItemsControl.ItemContainerStyle>
                <Style>
                    <Setter Property="spiral:SpiralPanel.DayTime" Value="{Binding When, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                </Style>
            </spiral:SpiralItemsControl.ItemContainerStyle>
            <spiral:SpiralItemsControl.ItemTemplate>
                <DataTemplate>
                    <DataTemplate.Resources>
                        <spiral:IsReflectedTimeConverter x:Key="isReflectedTimeConverter"/>
                    </DataTemplate.Resources>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
            
                            <Ellipse x:Name="spot" Grid.Column="0" Fill="Green" Stroke="Black" HorizontalAlignment="Left" StrokeThickness="2" Height="10" Width="10"  />
                            <StackPanel x:Name="dataPanel" Orientation="Vertical" Grid.Column="1">
                                <TextBlock Text="{Binding When}"/>
                                <Rectangle Height="2" HorizontalAlignment="Stretch"  Stroke="Black" StrokeThickness="2"/>
                                <TextBlock Text="Hello World! This is Greece!" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"/>
                            </StackPanel>
    
                    </Grid>
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding When, Converter={StaticResource isReflectedTimeConverter}}" Value="True">
                            <Setter TargetName="dataPanel" Property="LayoutTransform">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="-1" ScaleY="-1"/>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>
            </spiral:SpiralItemsControl.ItemTemplate>

        </spiral:SpiralItemsControl>

    </Grid>
</Window>
